<?php $view->extend('::base.html.php') ?>
<?php foreach ($view['session']->getFlash('error') as $message): ?>
    <div class="flash-error">
        <?php echo $message; ?>
    </div>
<?php endforeach; ?>
<?php foreach ($view['session']->getFlash('success') as $message): ?>
    <div class="flash-success">
        <?php echo $message; ?>
    </div>
<?php endforeach; ?>
<?php
if ($subscribers->count()) :
?>
<form action="<?php echo $view['router']->generate('account_subscribers_add', array('listid' => $listid)) ?>" method="post" <?php echo $view['form']->enctype($form) ?>>
<table border="1">

	<tr>
		<td>
		<?php echo $view['form']->widget($form['firstname']); ?>
		</td>
		<td>
		<?php echo $view['form']->widget($form['lastname']); ?>
		</td>
		<td>
		<?php echo $view['form']->widget($form['email']); ?>
		</td>
		<td colspan="4">
			<input type="submit" value="Quick add"/>
		</td>
	</tr>
	<tr>
		<th>First name</th>
		<th>Last name</th>
		<th>Email address</th>
		<th>Subscription source</th>
		<th>Subscription date</th>
	</tr>
	<?php 
		foreach ($subscribers as $subscriber) :
	?>
	<tr>
		<td>
			<?php echo $subscriber->getFirstname(); ?>
		</td>
		<td>
			<?php echo $subscriber->getLastname(); ?>
		</td>
		<td>
			<?php echo $subscriber->getEmail(); ?>
		</td>
		<td>
			<?php echo $subscriber->getSignedFrom(); ?>
		</td>
		<td>
			<?php echo $subscriber->getDateSigned()->format('Y-m-d H:i:s'); ?>
		</td>
		<td>
			<a href="<?php echo $view['router']->generate('account_subscribers_edit', array('id' => $subscriber->getId())); ?>">/</a>
		</td>
		<td>
			<a href="<?php echo $view['router']->generate('account_subscribers_delete', array('id' => $subscriber->getId())); ?>">&times;</a>
		</td>

	</tr>
	<?php	
		endforeach;
	?>
</table>
<?php echo $view['form']->widget($form['_token']); ?>
</form>
<?php
else :
?>
	<div>
		There are no subscribers in this list.<br/>
		<a href="<?php echo $view['router']->generate('account_subscribers_add', array('listid' => $listid)); ?>">Add one</a>
	</div>
<?php
endif;
?>
